package org.example;

import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;

import java.util.concurrent.TimeUnit;

public class Demo {
    public static void main(String[] args) throws InterruptedException {
        BCryptPasswordEncoder passwordEncoder = new BCryptPasswordEncoder();
        String pass = "123456";
        String repa1 = passwordEncoder.encode(pass);
        System.out.println(repa1);
        TimeUnit.SECONDS.sleep(1);
        String repa2 = passwordEncoder.encode(pass);
        System.out.println(repa2);
        TimeUnit.SECONDS.sleep(1);
        System.out.println(passwordEncoder.matches("654321", repa1));
        System.out.println(passwordEncoder.matches("123456", repa1));
        System.out.println(passwordEncoder.matches("123456", repa2));
    }
}
